using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace ClimbTracker.GUI.EntityForms
{
    public partial class CompetitorEditForm : CompetitorAddForm
    {
        public CompetitorEditForm()
        {
            InitializeComponent();
        }

        private void EditCompetitorForm_Load(object sender, EventArgs e)
        {
            // Adjust controls to Edit Form
            AddButton.Text = "Save";

            // Assign the controls with the competitor's details
            competitorIDLabel.Text = Competitor.CompetitorID.ToString();
            NameTextBox.Text = Competitor.Name;
            AgeNumericUpDown.Value = Competitor.Age;
            NationalityTextBox.Text = Competitor.Nationality;
            CategoryTextBox.Text = Competitor.Category;
            rankingNumericUpDown.Value = Competitor.Ranking;

            if(File.Exists(Competitor.PicturePath))
            {
                pictureBox.Load(Competitor.PicturePath);
                picturePathLabel.Text = Competitor.PicturePath;
            }
            else
            {
                picturePathLabel.Text = "Path to competitor's picture incorrect";
            }


        }
    }
}